<?php
    require_once ROOT . '_classes/locale/LocaleFactory.class.php';
    
    define('DEFAULT_LOCALE', 'en_US');

    if(empty($_SESSION[USER_LANG])){
	    $browserLanguage = Util::getBrowserLanguage();
	    if(in_array($browserLanguage, AbstractLang::getSupportedLanguages())){
	    	$_SESSION[USER_LANG] = $browserLanguage;
	    } else {
	    	$_SESSION[USER_LANG] = DEFAULT_LOCALE;
	    }
    }
    
    if(empty($_SESSION[CALENDAR_LOCALE])){
	    $browserLanguage = Util::getBrowserLanguage();
	    if(in_array($browserLanguage, AbstractLang::getSupportedLanguages())){
	    	$_SESSION[CALENDAR_LOCALE] = $browserLanguage;
	    } else {
	    	$_SESSION[CALENDAR_LOCALE] = DEFAULT_LOCALE;
	    }
    }
    
    /*Defining the language and the Holidays to use*/
    require_once ROOT . '_classes/language/' . $_SESSION[USER_LANG] . '/Lang.class.php';
    
    //Remove the below commented code
    //$_SESSION[USER_LANG] = 'en_US';
    //$_SESSION[USER_LANG] = 'es_ES';
    //$_SESSION[USER_LANG] = 'pt_BR';
    //$_SESSION[USER_LANG] = 'pt_PT';
?>
